google: now understands \xnn
authorparkrrrr <parkrrrr>
Thu, 10 Jan 2008 14:58:51 +0000 (14:58 +0000)
committerparkrrrr <parkrrrr>
Thu, 10 Jan 2008 14:58:51 +0000 (14:58 +0000)
google.c

index 0496d64222071820cce05d694c561f015cb1e63c..889405696561a673885807a286c71e355873c86c 100644 (file)
--- a/google.c
+++ b/google.c
@@ -353,9 +353,8 @@ google_read(void)
                    panel = strstr( dict, "panel:\"");
                    panelofs = 7;
                  }
-                 
                  tmp = panel;
-                 while ( tmp ) {
+                 while ( tmp ) {                        
                    if ( qc == '"' ) {
                      char *tmp1 = strstr( tmp, "\"points\":\"" );
                      if ( !tmp1 ) {
@@ -420,6 +419,9 @@ google_read(void)
                  if ( panel ) {
                    panel += panelofs;
                    end = strstr( panel, "/table><div class=\\\"legal" );
+                   if ( !end ) {
+                     end = strstr( panel, "/table\\x3e\\x3cdiv class=\\\"legal" );
+                   } 
                    if ( !end ) {
                      end = strstr( panel, "/table><div class=\\042legal" );
                    }               
@@ -435,7 +437,6 @@ google_read(void)
                        strcpy( end, "/div></div>");
                      }
                    }
-                   
                    if ( end ) {                                      
                      char *to = panel;
                      char *from = panel;
@@ -472,6 +473,12 @@ google_read(void)
                          *to++='>';
                          from += 6;
                        }
+                       else if ( !strncmp( from, "\\x", 2)) {
+                         unsigned int c;
+                         sscanf(from+2, "%2x", &c);
+                         *to++ = (char)c;
+                         from += 4;
+                       }
                        else if ( !strncmp( from, "\\'", 2)) {
                          *to++ = '\'';
                          from += 2;
@@ -497,6 +504,7 @@ google_read(void)
 #if 0 
                      {
                        FILE *foo = fopen( "foo.xml", "w" );
+                       fprintf(foo, "<!DOCTYPE foo [%s]>\n", xhtml_entities );
                        fwrite( panel, sizeof(char), strlen(panel), foo );
                        fclose( foo );
                      }